<template>
	<view>
		<view class="mg">
			<button type="primary" @click="downloadExcle" v-if="!downShow">销售端报表下载</button>
		</view>
		<view class="mg">
			<button type="primary" @click="downloadExcle1" v-if="!downShow1">专家端报表下载</button>
		</view>
		<view class="mg">
			<a :href="url" v-if="downShow">已获取销售端报表，点击下载</a>
		</view>
		<view class="mg">
			<a :href="url1" v-if="downShow1">已获取专家端报表，点击下载</a>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				downShow:false,
				downShow1:false,
				url:'',
				url1:'',
			}
		},
		methods: {
			downloadExcle(){
				uniCloud.callFunction({
					name:'chb-excel-demo'
				}).then((res)=>{
					console.log(res)
					this.url = res.result.url
					this.downShow = true
				}).catch((res)=>{
					console.log(res)
				})
			},
			downloadExcle1(){
				uniCloud.callFunction({
					name:'chb-excel-demo1'
				}).then((res)=>{
					console.log(res)
					this.url1 = res.result.url
					this.downShow1 = true
				}).catch((res)=>{
					console.log(res)
				})
			}
		}
	}
</script>

<style scoped>
.mg{
		margin-top: 40rpx;
	}
</style>
